package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.Integral;
import cn.wolfcode.trip.base.mapper.IntegralMapper;
import cn.wolfcode.trip.base.mapper.SigninMapper;
import cn.wolfcode.trip.base.service.IIntegralService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class IntegralServiceImpl implements IIntegralService {
    @Autowired
    private IntegralMapper integralMapper;

    @Override
    public void saveOrUpdate(Integral entity) {
        entity.setUpdateTime(new Date());
        entity.setState(false);
        integralMapper.insert(entity);
    }

    @Override
    public int getIntegralByUserId(Long userId) {
        return integralMapper.selectIntegralByUserId(userId);
    }
}
